`ifndef _EZCHIP_BASE_TEST_SVH
`define _EZCHIP_BASE_TEST_SVH

class ezchip_base_test extends uvm_test;

    `uvm_component_utils(ezchip_base_test)
    //  Group: Variables
    string tID;
    uvm_event test_start;
    uvm_event test_end;
    static ezchip_base_test m_obj;
    regAHB_agent ahb_agt;
    ahb_write_word_seq wr_seq;
    ahb_read_word_seq rd_seq;
    
    //  Group: Functions
    function void build_phase(uvm_phase phase);
        super.build_phase(phase);
        `uvm_info(tID, $sformatf("build_phase begin ..."), UVM_HIGH)
        wr_seq = ahb_write_word_seq::type_id::create("wr_seq");
        rd_seq = ahb_read_word_seq::type_id::create("rd_seq");
        ahb_agt = regAHB_agent::type_id::create("ahb_agt", this);
        m_obj = this;
    endfunction

    task main_phase(uvm_phase phase);
        super.main_phase(phase);
        `uvm_info(tID, $sformatf("main_phase begin ..."), UVM_HIGH)
    endtask : main_phase


    function void report_phase(uvm_phase phase);
        super.report_phase(phase);
        `uvm_info(tID, $sformatf("report_phase begin ..."), UVM_HIGH)
        do_report();
    endfunction : report_phase

    function void final_phase(uvm_phase phase);
        super.final_phase(phase);
        `uvm_info(tID, $sformatf("final_phase begin ..."), UVM_HIGH)
    endfunction : final_phase

    function void do_report();
        uvm_report_server rs=uvm_report_server::get_server();
        if(rs.get_severity_count(UVM_FATAL)+rs.get_severity_count(UVM_ERROR) == 0) begin
            $display("***********************************************************************");
            $display("******************         EZCHIP TEST PASS          ******************");
            $display("***********************************************************************");
        end else begin
            $display("***********************************************************************");
            $display("******************         EZCHIP TEST FAIL         ******************");
            $display("***********************************************************************");
        end

    endfunction : do_report

    //  Constructor: new
    function new(string name = "ezchip_base_test", uvm_component parent);
        super.new(name, parent);
        test_start = new("test_start");
        test_end = new("test_end");
        tID = get_type_name().toupper();
    endfunction: new

endclass : ezchip_base_test

`endif
